<template>
    <div class="article">
        <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="文章名称">
                <el-input v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item label="内容">
                <el-input type="textarea" v-model="form.content"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">发表</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
export default {
    data() {
      return {
        form: {
          name: '',
          content: ''
        }
      }
    },
    methods: {
      onSubmit() {
        this.$post('/api/article/add',this.form).then(res => {
          console.log(res.data)
        })
      }
    }
}
</script>

<style>
.article{
    width: 500px;
    margin: 10px auto;
}
</style>